<!DOCTYPE html>
<html lang="en">
	<head>
	<meta charset="utf-8" />
	<title>LMouseEvent</title>
	<script type="text/javascript" src="../../lufylegend-1.8.12.min.js"></script>
	<script type="text/javascript" src="../../lib/lufylegend.ui-0.8.0.min.js"></script>
	</head>
	<body style="margin: 0;padding: 0;">
			<div id="legend"></div>
<script>
init(50,"legend",800,450,main);
var layer,testLayer,label,xyLabel;

function main(){
	LGlobal.setDebug(true);
	layer = new LSprite();
	layer.graphics.drawRect(1,"#000000",[0,0,LGlobal.width,LGlobal.height],true,"#CCCCCC");
	addChild(layer);
	
	xyLabel = new LTextField();
	xyLabel.text = "MOUSE_MOVE:";
	xyLabel.x = 10;
	xyLabel.y = 10;
	layer.addChild(xyLabel);
	
	layer.addEventListener(LMouseEvent.MOUSE_MOVE,
		function(e){
			xyLabel.text = "MOUSE_MOVE : x="+e.offsetX+",y="+e.offsetY;
		}
	);

	testLayer = new LSprite();
	testLayer.x = 200;
	testLayer.y = 100;
	testLayer.graphics.drawRect(1,"#000000",[0,0,300,200],true,"#FFFFFF");
	layer.addChild(testLayer);
	
	label = new LTextField();
	label.text = "测试:\nMOUSE_OVER,\nMOUSE_OUT,\nMOUSE_DOWN,\nMOUSE_UP,\nDOUBLE_CLICK";
	label.setWordWrap(true,20);
	label.x = 10;
	label.y = 10;
	testLayer.addChild(label);
	
	label = new LTextField();
	label.text = "发生事件：";
	label.color = "#FF0000";
	label.x = 50;
	label.y = 140;
	testLayer.addChild(label);
	
	testLayer.addEventListener(LMouseEvent.MOUSE_OVER,
		function(e){
			label.text = "发生事件：MOUSE_OVER";
		}
	);
	testLayer.addEventListener(LMouseEvent.MOUSE_OUT,
		function(e){
			label.text = "发生事件：MOUSE_OUT";
		}
	);
	testLayer.addEventListener(LMouseEvent.MOUSE_DOWN,
		function(e){
			label.text = "发生事件：MOUSE_DOWN";
		}
	);
	testLayer.addEventListener(LMouseEvent.MOUSE_UP,
		function(e){
			label.text = "发生事件：MOUSE_UP";
		}
	);
	testLayer.addEventListener(LMouseEvent.DOUBLE_CLICK,
		function(e){
			trace("发生事件：DOUBLE_CLICK");
		}
	);
}
</script>
	</body>
</html>
